﻿<?php
	session_start();
	include "include.php";
	mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die(mysql_error());
	mysql_select_db(DB_NAME);
?>
<html>
<head>
<title><?php echo $SITE_TITLE ?> - User Maintenance</title>
<link rel="stylesheet" type="text/css" href="main.css" /></head>
</head>
<body>
<div id="container">
<div id="top">
<h1><?php echo $SITE_TITLE ?></h1>
</div>
<div id="leftnav">
<?php include "leftnav.php" ?>
</div>
<div id="content">
<?php
	$sql = "SELECT * from users ORDER BY users_login;";
	$result = mysql_query($sql);
?>
	<div>
		<form action="edit_users_process.php" method="post">
			<div>
				<table>
					<tr><th>Login Name</th><th>User Group</th><th>Reset Password</th><th>Delete User</th></tr>
<?php
	while($myrow = mysql_fetch_row($result)) {
?>
					<tr><td><?php echo ucwords($myrow[1]) ?></td><td>
<?php
					if($myrow[4] == 1) {
?>
						<input type="radio" value="1" name="users_rights_<?php echo $myrow[0] ?>" id="users_rights_<?php echo $myrow[0] ?>" checked="checked"> User
						<input type="radio" value="2" name="users_rights_<?php echo $myrow[0] ?>" id="users_rights_<?php echo $myrow[0] ?>"> Officer
						<input type="radio" value="3" name="users_rights_<?php echo $myrow[0] ?>" id="users_rights_<?php echo $myrow[0] ?>"> Admin
<?php
					}
?>
<?php
					if($myrow[4] == 2) {
?>
						<input type="radio" value="1" name="users_rights_<?php echo $myrow[0] ?>" id="users_rights_<?php echo $myrow[0] ?>"> User
						<input type="radio" value="2" name="users_rights_<?php echo $myrow[0] ?>" id="users_rights_<?php echo $myrow[0] ?>" checked="checked"> Officer
						<input type="radio" value="3" name="users_rights_<?php echo $myrow[0] ?>" id="users_rights_<?php echo $myrow[0] ?>"> Admin
<?php
					}
?>
<?php
					if($myrow[4] == 3) {
?>
						<input type="radio" value="1" name="users_rights_<?php echo $myrow[0] ?>" id="users_rights_<?php echo $myrow[0] ?>"> User
						<input type="radio" value="2" name="users_rights_<?php echo $myrow[0] ?>" id="users_rights_<?php echo $myrow[0] ?>"> Officer
						<input type="radio" value="3" name="users_rights_<?php echo $myrow[0] ?>" id="users_rights_<?php echo $myrow[0] ?>" checked="checked"> Admin
<?php
					}
?>
					</td><td><a href="reset_password.php?users_id=<?php echo $myrow[0] ?>">Reset</a></td><td><a href="delete_user.php?users_id=<?php echo $myrow[0] ?>">Delete</a></td></tr>
<?php
	}
?>
				</table>
			</div>
			<INPUT type="submit" value="Send"> <INPUT type="reset">
		</form>
	</div>
</div>
<div id="footer">
<?php include "footer.php" ?>
</div>
</div>
</body>
</html>
